#include <bits/stdc++.h>

using namespace std;

const int maxn=300005;
const double pi=acos(-1);

struct comp{
    double r,i;
    comp(double r=0,double i=0):r(r),i(i){}
    const comp operator + (const comp &c) const{return comp(r+c.r,i+c.i);}
    const comp operator - (const comp &c) const{return comp(r-c.r,i-c.i);}
    const comp operator * (const comp &c) const{return comp(r*c.r-i*c.i,r*c.i+i*c.r);}
};
comp a[maxn],b[maxn];
int rev[maxn],n;

void fft(comp *a,int f){
    for(int i=0;i<n;i++) if(i<rev[i]) swap(a[i],a[rev[i]]);
    for(int i=1;i<n;i<<=1){
        comp wn=comp(cos(pi/i),f*sin(pi/i));
        for(int j=0;j<n;j+=i*2){
            comp w=comp(1,0);
            for(int k=0;k<i;k++){
                comp x=a[j+k],y=w*a[j+k+i];
                a[j+k]=x+y;a[j+k+i]=x-y;
                w=w*wn;
            }
        }
    }
    if(f==-1) for(int i=0;i<n;i++) a[i].r/=n;
}

inline int read(){
    int r;char c;bool f=0;
    for(c=getchar();c>'9'||c<'0';c=getchar()) if(c=='-') f=1;
    for(r=0;c<='9'&&c>='0';c=getchar()) r=r*10+c-'0';
    if(f) return -r;
    else return r;
}

int main(){
    int m,lg;

    n=read();m=read();
    for(int i=0;i<=n;i++) a[i].r=read(),a[i].i=0;
    for(int j=0;j<=m;j++) b[j].r=read(),b[j].i=0;
    m=n+m;n=1;lg=0;
    while(n<=m) n<<=1,lg++;
    assert(n==(1<<lg));
    rev[0]=0;
    for(int i=1;i<n;i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<(lg-1));
    //for(int i=0;i<n;i++) printf("%d ",rev[i]);putchar('\n');
    fft(a,1);
    fft(b,1);
    for(int i=0;i<n;i++) a[i]=a[i]*b[i];
    fft(a,-1);
    for(int i=0;i<=m;i++) printf("%d ",(int)(a[i].r+0.5));

    return 0;
}
